import request from '@/utils/request'

// 获取课程列表
export function course(params) {
  return request({
    url: `/v1/study/course`,
    method: 'GET',
    params
  })
}
// 给用户添加课程
export function addUserCourse(data) {
  return request({
    url: `/v1/study/course/user`,
    method: 'post',
    data: data
  })
}

// 创建课程
export function createCourse(data) {
  return request({
    url: `/v1/study/course`,
    method: 'post',
    data: data
  })
}

// 修改课程
export function reviseCourse(data) {
  return request({
    url: `/v1/study/course`,
    method: 'put',
    data: data
  })
}

// 删除课程
export function deleteCourses(params) {
  return request({
    url: `/v1/study/course`,
    method: 'delete',
    params
  })
}

// 删除用户课程
export function deleteUserCourses(params) {
  return request({
    url: `/v1/study/course/user`,
    method: 'delete',
    params
  })
}

// 用户获取课程列表
export function courseList(params) {
  return request({
    url: `/v1/study/content`,
    method: 'GET',
    params
  })
}

// 获取课程详情
export function courseDetail(data, params) {
  return request({
    url: `/v1/study/course/${data}`,
    method: 'GET',
    params
  })
}

// 获取视频列表
export function videosList(params) {
  return request({
    url: `/v1/study/videos`,
    method: 'GET',
    params
  })
}

// 给课程添加学习资料
export function addStudies(data) {
  return request({
    url: `/v1/study/course/studies`,
    method: 'post',
    data: data
  })
}

// 课程删除学习资料
export function deleteStudies(params) {
  return request({
    url: `/v1/study/course/studies`,
    method: 'delete',
    params
  })
}
// 创建上传任务
export function createUploadTask(data) {
  return request({
    url: `/v1/study/initialization`,
    method: 'POST',
    data
  })
}

// 上传片
export function uploadSlice(data) {
  return request({
    url: `/v1/study/singular`,
    method: 'POST',
    data
  })
}

// 合并
export function mergeSlices(data) {
  return request({
    url: `/v1/study/merge`,
    method: 'POST',
    data
  })
}

// 获取视频列表
export function getVideos(params) {
  return request({
    url: `/v1/study/videos`,
    method: 'GET',
    params
  })
}

// 添加视频
export function addContent(data) {
  return request({
    url: `/v1/study/content`,
    method: 'POST',
    data
  })
}

// 课程列表
export function courses(params) {
  return request({
    url: `/v1/study/content`,
    method: 'GET',
    params
  })
}

// 删除视频
export function deleteVideo(data) {
  return request({
    url: `/v1/study/videos`,
    method: 'delete',
    data
  })
}

// 培训课选择试卷
export function addPapers(data) {
  return request({
    url: `/v1/study/train`,
    method: 'POST',
    data
  })
}

// 课程删除试卷
export function deletePaper(params) {
  return request({
    url: `/v1/study/train`,
    method: 'delete',
    params
  })
}

// 课程修改试卷时间
export function changePaperTime(data) {
  return request({
    url: `/v1/study/train`,
    method: 'put',
    data: data
  })
}

// 查询某一课程所学者进度
export function progress(params) {
  return request({
    url: `/v1/study/course/user/schedules`,
    method: 'GET',
    params
  })
}

// 学习情况统计
export function statistics(params) {
  return request({
    url: `/v1/statistics/study`,
    method: 'GET',
    params
  })
}

// 获取课程中试卷考试详情
export const getCoursePaperDetails = (params) => {
  return request({
    url: '/v1/test/examination/course',
    method: 'GET',
    params
  })
}
